﻿<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>
{{$config->webname}}
</title>
<meta name="csrf-token" content="{{ csrf_token() }}" />
<meta name="Keywords" content="{{$config->keywords}}" />
<!--========================================-->
<!--bootstrap引入-->
<link href="{{asset('homeCSS/dist/css/bootstrap.min.css')}}" rel="stylesheet">
<link href="{{asset('homeCSS/dist/css/docs.min.css')}}" rel="stylesheet">
<script src="{{asset('homeCSS/dist/js/jquery-1.12.4.min.js')}}"></script>
<script src="{{asset('homeCSS/dist/js/bootstrap.min.js')}}"></script>

<link rel="stylesheet" href="{{asset('homeCSS/search/jquery-ui.css')}}">


<link rel="stylesheet" type="text/css" href="{{asset('homeCSS/login/css/style.css')}}" />
<script type="text/javascript" src="{{asset('homeCSS/login/js/jquery-1.8.3.min.js')}}"></script>
<script src="{{asset('homeCSS/login/js/main.js')}}"></script>
<!--===========================================-->
<link rel="stylesheet" href="{{asset('homeCSS/css/moco.min.css')}}" type="text/css" />
<link rel="stylesheet" href="{{asset('homeCSS/css/index.css')}}" type="text/css" />
<style>
		a:hover {     
		text-decoration: none;   
		}   
</style>
<script type="text/javascript">



$(window).scroll(function(){
  //元素到文档的距离
  var oT = $('#header').offset().top;
  //元素滚动距离
  var pT = $(window).scrollTop();
  if(pT>1){
    $('#header').css('background','rgba(0,0,0,1)');
    $('#btn').css('background','rgba(0,0,0,1)');
    $('.search-area').css('border-bottom','1px solid #ccc');
  }else if(oT<1){
    $('#header').css('background','rgba(0,0,0,0.0)');
    $('#btn').css('background','rgba(0,0,0,0)');
    $('.search-area').css('border-bottom','0px solid #ccc');
  }

})
</script>
<!-- ================================================== -->
<script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
<link href="{{asset('homeCSS/css/style.css')}}" rel="stylesheet" type="text/css" media="all" />

<script src="{{asset('homeCSS/js/jquery.min.js')}}"></script>
<script src="{{asset('homeCSS/js/easyResponsiveTabs.js')}}" type="text/javascript"></script>
  
<!-- =================================================== -->




<link rel="stylesheet" href="{{asset('homeCSS/css/41a6e2fef0f542bebbf5551383a3f6b6.css')}}" type="text/css" />
</head>
<body  id="List_courseId">
<!-- ===================================================== -->

<!-- ========================================================= -->
<div id="header" class="navbar-fixed-top" style="background:rgba(0,0,0,0.0);">
    <div class="page-container" id="nav">
      <a href="/"><div id="logo"  class="logo"><img src="{{$config->logo}}" style="margin:0px;width:140px;height:60px"></div></a>

        <button type="button" class="navbar-toggle visible-xs-block js-show-menu" >
            <i class="icon-menu"></i>
        </button>
        <ul class="nav-item">
                        <li class="set-btn visible-xs-block"><a href="/user/newlogin" target="_self" id="login">登录</a> / <a href="/user/newsignup" target="_self">注册</a></li>
            <li>
                <a href="/"  target="_self">首页</a>
            </li>      
            <li>
                <a href="/home/film" target="_self">电影</a>
            </li>
            <li><a href="/home/tv" class="program-nav " target="_self">电视剧<i class="icn-new"></i></a></li>
            <li><a href="/home/comic" target="_self">动漫</a></li>
            <li><a href="/home/original"  target="_self">原创</a></li>
            <li><a href="/home/zixun"  target="_self">资讯</a></li>
            <li>
            	
            	<!-- Single button -->
            	<div class="dropdown">
				  
		              <a aria-expanded="true" aria-haspopup="true" role="button" data-toggle="dropdown" class="dropdown-toggle" href="#" id="drop2">
		                更多
		                <span class="caret"></span>
		              </a>
		              <ul style="red;width:80px" aria-labelledby="drop2" class="dropdown-menu">
		                <li><a href="/home/military" style="width:75px;height:30px;">旅游</a></li>
		                <li><a href="/home/tourism" style="width:75px;height:30px;">军事</a></li>
		                <li><a href="/home/sports" style="width:75px;height:30px;">体育</a></li>
		                <li><a href="/home/education" style="width:75px;height:30px;">教育</a></li>
		                <li><a href="/home/game" style="width:75px;height:30px;">游戏</a></li>
		               
		                <li><a href="/home/natural" style="width:75px;height:30px">自然</a></li>
		              </ul>
		          
            	</div>

            </li>
          <!-- Single button -->
         
        </ul>
                <div id="login-area">
            <ul class="header-unlogin clearfix">
                <li class="shop-cart" id="shop-cart" style="margin-right:30px;">
                    <a href="/home/numlist" target="_blank">
                        <span style="color:white;">电影排行</span>
                    </a>
                </li>
               
                @if(!session('uid'))
              <li  style="margin-top:20px;">
              <span class="main_nav">
                <a id="logins" class="cd-signin" style="color:white;"  href="#">登录/</a>
                  <a id="regisetrs" class="cd-signup" style="color:white;" href="#">注册</a>
              </span>
             </li>
           @else
            <li  style="width:100px;">
                <div style="float:left;"><a  style="color:white;"  href="/geren" >{!! \App\Http\Controllers\ShareController::share() !!} </a></div>
                <div style="width:40px;float:right;margin-top:20px;"><a  style="color:white;" href="/login/loginout">注销</a></div>
            </li>
           @endif
                          </ul>
                      </div>
                       <!-- =====================================搜索提示================================================= -->
              <div id="searchdiv" class='search-warp clearfix' style='min-width: 32px;height:50px;'>

              <form action="/home/search" method="get">
                <div class="search-area" data-search="top-banner" style="border:0px;border-bottom:1px solid #ccc;background:rgba(0,0,0,0.3)" >
                    <input style="margin:7px;" id="search" class="search-input" name="keyword" data-suggest-trigger="suggest-trigger" type="text" autocomplete="off" placeholder="请输入关键字" >
                    <ul class="search-area-result" data-suggest-result="suggest-result">
                      </ul>
                      </div>
                       <div class='showhide-search' data-show='no'>
                     <button type="submit" id="btn" style="background: rgba(0,0,0,0);"><i class='icon-search' style="color:orange"></i></button>
                 </div>
            </form>
            
            <!-- ==================================================================================================== -->

                      </div>
                  </div>
      </div>

          
  <div id="main" > 
  <div class="cd-user-modal"> 
            <div class="cd-user-modal-container">
              <ul class="cd-switcher">
                <li><a id="log" href="#0" style="background:#fff;">用户登录</a></li>
                <li></li>
                <li><a id="reg" href="#0" style="background:#fff;">注册新用户</a></li>
              </ul>

              <div id="cd-login"> <!-- 登录表单 -->
                <form class="cd-form" id="formtwo" >
                  <p class="fieldset">
                    <label  style="width:100px;color:#ccc;">用户名</label>
                    <input id="nametwo" name="username" style="width:440px;" class="full-width has-padding has-border" id="signup-username" type="text" placeholder="请输入6-18位用户名">
                  <span ></span>
                  </p>
                  <p class="fieldset">
                    <label style="width:100px;color:#ccc;">密码</label>
                    <input id="passwordtwo" name="password" style="width:440px;" class="full-width has-padding has-border" id="signup-password" type="password"  placeholder="输入6-18位密码">
                    <span></span>
                  </p>
                  <p class="fieldset" style="height:33px;">
                    <input type="checkbox" id="remember-me"  checked>
                    <label for="remember-me">记住登录状态</label>
                  </p>
                  {{ csrf_field() }}

                  <p class="fieldset">
                    <input class="full-width2" type="submit" value="登 录">
                  </p>
                </form>
              </div>

              <div id="cd-signup"> <!-- 注册表单 -->
                <form class="cd-form" id="formone" >
                  <p class="fieldset">
                    <label style="width:100px;color:#ccc;">用户名</label>
                    <input id="nameone" name="username" style="width:440px;" class="full-width has-padding has-border" id="signup-username" type="text" placeholder="请输入6-18位用户名">
                  <span></span>
                  </p>

                  <p class="fieldset">
                    <label style="width:100px;color:#ccc;">密码</label>
                    <input id="passwordone" name="password" style="width:440px;" class="full-width has-padding has-border" id="signup-password" type="password"  placeholder="输入6-18位密码">
                    <span></span>
                  </p>

                   <p class="fieldset">
                    <label style="width:100px;color:#ccc;">确认密码</label>
                    <input id="repasswordone" style="width:440px;" class="full-width has-padding has-border" id="signup-password" type="password"  placeholder="再次输入6-18位密码">
                  <span></span>
                  </p>

                  <p class="fieldset">
                    <label style="width:100px;color:#ccc;">手机号</label>
                    <input name="phone" id="phone" style="width:440px;" class="full-width has-padding has-border" id="signup-password" type="text"  placeholder="输入手机号">
                  <span></span>
                  </p>

                   <p class="fieldset">
                    <label  style="width:400px;color:#ccc;">手机验证码</label>
                    <div style="width:100%;margin-top:-30px;">
                    <input id="yzm" style="width:200px;" class="full-width has-padding has-border"  type="text" placeholder="输入手机验证码">
                    <button id="getcode" style="height:50px;width:100px;">获取手机验证码</button>
                    <span id="yzmok"></span>
                  </div>
                  </p>
                  <p class="fieldset">
                    <input class="full-width2" type="submit" style="background:#0099CC" value="注册新用户">
                  </p>
                  {{ csrf_field() }}
                </form>
              </div>

              <a href="#0" class="cd-close-form">关闭</a>
            </div>
          </div> 

  		<!-- 轮播 -->
  		<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
  		  <!-- Indicators -->
  		  <ol class="carousel-indicators">
  		    <li data-target="#carousel-example-generic" data-slide-to="0" class="active" ></li>
  		    <li data-target="#carousel-example-generic" data-slide-to="1"></li>
  		    <li data-target="#carousel-example-generic" data-slide-to="2"></li>
  		  </ol>

  		  <!-- Wrapper for slides -->
  		  <div class="carousel-inner" role="listbox">
  		    <div class="item active">
  		      <img src="{{asset('homeCSS/images/006.jpg')}}" width="100%" alt="...">
  		      <div class="carousel-caption">
  		        ...
  		      </div>
  		    </div>
  		   	<div class="item ">
  		   	  <img src="{{asset('homeCSS/images/005.jpg')}}" width="100%" alt="...">
  		   	  <div class="carousel-caption">
  		   	    ...
  		   	  </div>
  		   	</div>
  		   	<div class="item ">
  		   	  <img src="{{asset('homeCSS/images/002.jpg')}}" width="100%" alt="...">
  		   	  <div class="carousel-caption">
  		   	    ...
  		   	  </div>
  		   	</div>
  		  </div>

  		  <!-- Controls -->
  		  <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
  		    <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
  		    <span class="sr-only">Previous</span>
  		  </a>
  		  <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
  		    <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
  		    <span class="sr-only">Next</span>
  		  </a>
  		</div>
  		<!--=================-->
   <!-- 设置容器 -->
    <div class="container-types clearfix" > 
        
		<!-- 版块 -->
   		<div class="row" style="background:white;margin-top:-15px;">
    
      <!-- 电影 -->
  			<div class="col-md-12" style="height:50px;border-bottom:1px #ccc solid;">
  				<a href="/home/film" style="font-size:20px;line-height:50px;">{{$video->type}}></a>
				<a href="/home/film" style="line-height:50px;float:right">更多</a>
  			</div>
          <div class="moco-course-wrap  course-card-container" style="height:352px;width:450px;margin-left:16px;">
            <a href="/play/index?vid={{$video->id}}">
                <div class="moco-course-box" style="height:300px;width:450px">
    				@if(!empty($video->vips))
    	                <img style="position:absolute;width:20px;height:10px;" src="{{asset('homeCSS\img\QQ截图20170408154156.png')}}" alt="">
    	            @endif
                    <img width="100%" src="{{$video->url}}" alt="">
                </div>
            </a>
              <div class="moco-course-bottom" style="height:51px;margin-left:20px;margin-top:5px;" >
                  <div >
                    <span  style="height:20px;line-height:20px;font-size:15px;margin-top:2px;color:#4f5050;">电影名称</span>
                    <span  style="height:20px;line-height:20px;font-size:15px;margin-top:2px;margin-left:40px;color:#4f5050;">{{$video->film}}</span>
                  </div>
                  <div style="margin-top:10px;">
                    <p style="width:200px;height:18px;line-height:18px;margin:-7px 0px;font-size:13px">播放{{$video->click}}<span style="margin-left:40px">评论12344</span></p>
                  </div>
              </div>
          </div>
            @foreach($videos as $k=>$v)
          <div class="moco-course-wrap  course-card-container" style="height:160px;margin-left:15px;">
            <a href="/play/index?vid={{$v->id}}">
                <div class="moco-course-box">
                	@if($v->vips !='')
                	<img style="position:absolute;width:20px;height:10px;" src="{{asset('homeCSS\img\QQ截图20170408154156.png')}}" alt="">
                	@endif
                    <img width="100%" src="{{$v->url}}" alt="">
                    <div class="moco-course-intro" style="margin-top:60px;background:rgba(0,0,0,0.2)">
                       <p style="font-size:13px;color:white;">{{$v->describe}}</p>
                    </div>
                    <div class="moco-course-bottom" style="height:51px" >
                      <span  style="height:20px;line-height:20px;font-size:15px;margin-top:2px;color:#4f5050;">电影名称</span>
                      <span  style="height:20px;line-height:20px;font-size:15px;margin-top:2px;margin-left:40px;color:#4f5050;">{{$v->film}}</span>
                      <br><p style="width:200px;height:18px;line-height:18px;margin:-7px 0px;font-size:13px">播放{{$v->click}}<span style="margin-left:40px">评论{{$v->click}}</span></p>
                    </div>
                </div>
            </a>
          </div>
          @endforeach

        <!-- 电视剧 -->
        <div class="col-md-12" style="height:50px;border-bottom:1px #ccc solid;">
          <a href="/home/tv" style="font-size:20px;line-height:50px;">{{$tv->type}}></a>
        <a href="/home/tv" style="line-height:50px;float:right">更多</a>
        </div>
          <div class="moco-course-wrap  course-card-container" style="height:352px;width:450px;margin-left:16px;">
            <a href="/play/index?vid={{$tv->id}}">
                <div class="moco-course-box" style="height:300px;width:450px">
    				@if(!empty($video->vips))
    	                <img style="position:absolute;width:20px;height:10px;" src="{{asset('homeCSS\img\QQ截图20170408154156.png')}}" alt="">
    	            @endif
                    <img width="100%" src="{{$tv->url}}" alt="">
                </div>
            </a>
              <div class="moco-course-bottom" style="height:51px;margin-left:20px;margin-top:5px;" >
                  <div >
                    <span  style="height:20px;line-height:20px;font-size:15px;margin-top:2px;color:#4f5050;">电影名称</span>
                    <span  style="height:20px;line-height:20px;font-size:15px;margin-top:2px;margin-left:40px;color:#4f5050;">{{$tv->film}}</span>
                  </div>
                  <div style="margin-top:10px;">
                    <p style="width:200px;height:18px;line-height:18px;margin:-7px 0px;font-size:13px">播放{{$tv->click}}<span style="margin-left:40px">评论12344</span></p>
                  </div>
              </div>
          </div>
            @foreach($tvs as $k=>$v)
          <div class="moco-course-wrap  course-card-container" style="height:160px;margin-left:15px;">
            <a href="/play/index?vid={{$v->id}}">
                <div class="moco-course-box">
                	@if($v->vips !='')
                	<img style="position:absolute;width:20px;height:10px;" src="{{asset('homeCSS\img\QQ截图20170408154156.png')}}" alt="">
                	@endif
                    <img width="100%" src="{{$v->url}}" alt="">
                    <div class="moco-course-intro" style="margin-top:60px;background:rgba(0,0,0,0.2)">
                       <p style="font-size:13px;color:white;">{{$v->describe}}</p>
                    </div>
                    <div class="moco-course-bottom" style="height:51px" >
                      <span  style="height:20px;line-height:20px;font-size:15px;margin-top:2px;color:#4f5050;">电影名称</span>
                      <span  style="height:20px;line-height:20px;font-size:15px;margin-top:2px;margin-left:40px;color:#4f5050;">{{$v->film}}</span>
                      <br><p style="width:200px;height:18px;line-height:18px;margin:-7px 0px;font-size:13px">播放{{$v->click}}<span style="margin-left:40px">评论{{$v->click}}</span></p>
                    </div>
                </div>
            </a>
          </div>
          @endforeach
			
		<!-- 动漫 -->
		<div class="col-md-12" style="height:50px;border-bottom:1px #ccc solid;">
		  <a href="/home/comic" style="font-size:20px;line-height:50px;">{{$comic->type}}</a>
		<a href="/home/comic" style="line-height:50px;float:right">更多</a>
		</div>
		  <div class="moco-course-wrap  course-card-container" style="height:352px;width:450px;margin-left:16px;">
		    <a href="/play/index?vid={{$comic->id}}">
		        <div class="moco-course-box" style="height:300px;width:450px">
        			@if(!empty($video->vips))
                        <img style="position:absolute;width:20px;height:10px;" src="{{asset('homeCSS\img\QQ截图20170408154156.png')}}" alt="">
                    @endif
		            <img width="100%" src="{{$comic->url}}" alt="">
		        </div>
		    </a>
		      <div class="moco-course-bottom" style="height:51px;margin-left:20px;margin-top:5px;" >
		          <div >
		            <span  style="height:20px;line-height:20px;font-size:15px;margin-top:2px;color:#4f5050;">电影名称</span>
		            <span  style="height:20px;line-height:20px;font-size:15px;margin-top:2px;margin-left:40px;color:#4f5050;">{{$tv->film}}</span>
		          </div>
		          <div style="margin-top:10px;">
		            <p style="width:200px;height:18px;line-height:18px;margin:-7px 0px;font-size:13px">播放{{$original->click}}<span style="margin-left:40px">评论12344</span></p>
		          </div>
		      </div>
		  </div>
		    @foreach($comics as $k=>$v)
		  <div class="moco-course-wrap  course-card-container" style="height:160px;margin-left:15px;">
		    <a href="/play/index?vid={{$v->id}}">
		        <div class="moco-course-box">
			        @if($v->vips !='')
			        <img style="position:absolute;width:20px;height:10px;" src="{{asset('homeCSS\img\QQ截图20170408154156.png')}}" alt="">
			        @endif
		            <img width="100%" src="{{$v->url}}" alt="">
		            <div class="moco-course-intro" style="margin-top:60px;background:rgba(0,0,0,0.2)">
		               <p style="font-size:13px;color:white;">{{$v->describe}}</p>
		            </div>
		            <div class="moco-course-bottom" style="height:51px" >
		              <span  style="height:20px;line-height:20px;font-size:15px;margin-top:2px;color:#4f5050;">电影名称</span>
		              <span  style="height:20px;line-height:20px;font-size:15px;margin-top:2px;margin-left:40px;color:#4f5050;">{{$v->film}}</span>
		              <br><p style="width:200px;height:18px;line-height:18px;margin:-7px 0px;font-size:13px">播放{{$v->click}}<span style="margin-left:40px">评论{{$v->click}}</span></p>
		            </div>
		        </div>
		    </a>
		  </div>
		  @endforeach
		
		<!-- 原创 -->
		<div class="col-md-12" style="height:50px;border-bottom:1px #ccc solid;">
		  <a href="/home/original" style="font-size:20px;line-height:50px;">{{$original->type}}></a>
		<a href="/home/original" style="line-height:50px;float:right">更多</a>
		</div>
		  <div class="moco-course-wrap  course-card-container" style="height:352px;width:450px;margin-left:16px;">
		    <a href="/play/index?vid={{$original->id}}">
		        <div class="moco-course-box" style="height:300px;width:450px">
        			@if(!empty($video->vips))
                        <img style="position:absolute;width:20px;height:10px;" src="{{asset('homeCSS\img\QQ截图20170408154156.png')}}" alt="">
                    @endif
		            <img width="100%" src="{{$original->url}}" alt="">
		        </div>
		    </a>
		      <div class="moco-course-bottom" style="height:51px;margin-left:20px;margin-top:5px;" >
		          <div >
		            <span  style="height:20px;line-height:20px;font-size:15px;margin-top:2px;color:#4f5050;">电影名称</span>
		            <span  style="height:20px;line-height:20px;font-size:15px;margin-top:2px;margin-left:40px;color:#4f5050;">{{$tv->film}}</span>
		          </div>
		          <div style="margin-top:10px;">
		            <p style="width:200px;height:18px;line-height:18px;margin:-7px 0px;font-size:13px">播放{{$original->click}}<span style="margin-left:40px">评论12344</span></p>
		          </div>
		      </div>
		  </div>
		    @foreach($originals as $k=>$v)
		  <div class="moco-course-wrap  course-card-container" style="height:160px;margin-left:15px;">
		    <a href="/play/index?vid={{$v->id}}">
		        <div class="moco-course-box">
		        	@if($v->vips !='')
		        	<img style="position:absolute;width:20px;height:10px;" src="{{asset('homeCSS\img\QQ截图20170408154156.png')}}" alt="">
		        	@endif
		            <img width="100%" src="{{$v->url}}" alt="">
		            <div class="moco-course-intro" style="margin-top:60px;background:rgba(0,0,0,0.2)">
		               <p style="font-size:13px;color:white;">{{$v->describe}}</p>
		            </div>
		            <div class="moco-course-bottom" style="height:51px" >
		              <span  style="height:20px;line-height:20px;font-size:15px;margin-top:2px;color:#4f5050;">电影名称</span>
		              <span  style="height:20px;line-height:20px;font-size:15px;margin-top:2px;margin-left:40px;color:#4f5050;">{{$v->film}}</span>
		              <br><p style="width:200px;height:18px;line-height:18px;margin:-7px 0px;font-size:13px">播放{{$v->click}}<span style="margin-left:40px">评论{{$v->click}}</span></p>
		            </div>
		        </div>
		    </a>
		  </div>
		  @endforeach


         
          <!--轮播图下小图片-->
         <div class="col-md-12" role="listbox" style="margin-top:10px;margin-bottom:10px;"> 
            <a href="/ads"><img src="{{$ad->content}}" height="100px" width="100%" alt="..."></a>
         </div>
  		</div>
	</div>
   </div>
  </div> 
 <div class="footer bg-white idx-minwidth"> 
   <div class="container"> 
    
    <div class="footer-link"> 
     <!-- <a href="/about/us" target="_blank" title="关于我们">关于我们</a> --> 
     {!! \App\Http\Controllers\ShareController::firend() !!}
    </div> 
    <div class="footer-copyright"> 
     <p>&copy;&nbsp;2017&nbsp;imooc.com&nbsp;&nbsp;京ICP备 13046642号-2版权{{$config->copy}}</p> 
    </div> 
   </div>
  </div>
  <!--script-->  

 </body>
 
<script type="text/javascript" src="{{asset('homeCSS/search/jquery-ui.js')}}"></script>
 <script type="text/javascript">
  $(function() {
    //===================搜索提示===============================
    $.get('/home/znsearch',function(data){
      var data = eval(data);
    $( "#search" ).autocomplete({
      source: data
    });
    })
      });
  // =========================================================
 </script>
 <script type="text/javascript">
      
      var Useris = true;
      var Passis = true;



      //绑定表单提交事件
      $('#formtwo').submit(function(){
        //触发所有的丧失焦点事件
        $('#nametwo').trigger('blur');
        $('#passwordtwo').trigger('blur');
         //检测所有字段是否正确
         if(Useris && Passis){
                  $.ajaxSetup({
                      headers: {
                          'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                      }
              });
                //登录ajax
                $.ajax({
                  url:'/login/login',
                  data:{username:$('#nametwo').val(),password:$('#passwordtwo').val()},
                  type:'post',
                  success:function(data){
                    if(data == 0){
                     
                     $('#nametwo').parent('p').find('span').html('登录失败').css('color','red');
                    }else{
                      location.reload();
                      
                    }
                  },
                  async:false
                })
        }else{
          //阻止默认行为
          alert('登录失败');
        }
        return false;
      })
        
         //用户名
       $('#nametwo').blur(function(){
         var reg = /^\w{6,18}$/;
         if(reg.test($(this).val())){
          Useris = true;
           $(this).parent('p').find('span').html('√').css('color','green');
           $(this).parent('p').attr('class','form-group has-success');
         }else{
           $(this).parent('p').find('span').html('格式不正确').css('color','red');
           $(this).parent('p').attr('class','form-group has-error');
           Useris = false;
         }
       })

      //密码验证
       $('#passwordtwo').blur(function(){
         var reg = /^\w{6,18}$/;
         if(reg.test($(this).val())){
           Passis = true;
           $(this).parent('p').find('span').html('√').css('color','green');
           $(this).parent('p').attr('class','form-group has-success');
         }else{
           $(this).parent('p').find('span').html('密码格式不正确').css('color','red');
           $(this).parent('p').attr('class','form-group has-error');
           Passis = false;
         }
       })

// =========================================================================================

     //注册全局变量
            var UserisOk = true;
            var PassisOk = true;
            var RePassisOk = true;
            var YzmOk = true;
            var PhoneisOk = true;
          //绑定表单提交事件
          $('#formone').submit(function(){
            //触发所有的丧失焦点事件
            $('#nameone').trigger('blur');
            $('#passwordone').trigger('blur');
            $('#repasswordone').trigger('blur');
             $('#yzm').trigger('blur');
            if(UserisOk && PassisOk && RePassisOk && YzmOk && PhoneisOk){
                  $.ajaxSetup({
                        headers: {
                            'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                        }
                });

                   //注册ajax
            $.ajax({
              url:'/login/register',
              data:{username:$('#nameone').val(),password:$('#passwordone').val(),phone:$('#phone').val()},
              type:'post',
              success:function(data){
                if(data == 1){

                  alert('注册成功,请登录');
                  document.getElementById("logins").click();
                 
                }else{
                  
                $('#nameone').parent('p').find('span').html('注册失败').css('color','red');

                }
              },
              async:false
            })

            }else{
                //提示用户
            }
            return false;
          })

         //用户名绑定丧失焦点事件
         $('#nameone').blur(function(){
           if($(this).val() != '' && $(this).val().length >= 6 && $(this).val().length <= 18){
             //发送ajax去验证用户名是否存在
             var inp = $(this);
             $.ajax({
               url:'/login/nameyz',
               data:{name:inp.val()},
               type:'get',
               success:function(data){
                 if(data == 1){
                   inp.parent('p').find('span').html('√').css('color','green');
                   inp.parent('p').attr('class','form-group has-success');
                   UserisOk = true;
                 }else{
                   inp.parent('p').find('span').html('用户名已存在').css('color','red');
                   inp.parent('p').attr('class','form-group has-warning');
                   UserisOk = false;
                 }
               },
               async:false
             })
           }else{
             $(this).parent('p').find('span').html('用户名不合法').css('color','red');
             
             $(this).parent('div').attr('class','form-group has-error');
             UserisOk = false;
             
           }
         })


        //密码验证
         $('#passwordone').blur(function(){
           var reg = /^\w{6,18}$/;
           if(reg.test($(this).val())){
             PassisOk = true;
             $(this).parent('p').find('span').html('√').css('color','green');
             $(this).parent('p').attr('class','form-group has-success');
           }else{
             $(this).parent('p').find('span').html('密码格式不正确').css('color','red');
             $(this).parent('p').attr('class','form-group has-error');
             PassisOk = false;
           }
         })


         //确认密码验证
         $('#repasswordone').blur(function(){
           var reg = /^\w{6,18}$/;
           var pass = $('#passwordone').val();
           if(reg.test($(this).val()) && $(this).val() == pass){
              RePassisOk = true;
             $(this).parent('p').find('span').html('√').css('color','green');
             $(this).parent('p').attr('class','form-group has-success');
           }else{
             $(this).parent('p').find('span').html('两次密码不一致').css('color','red');
             $(this).parent('p').attr('class','form-group has-error');
             RePassisOk = false;
           }
         })
         $('#logins').click(function(){
          $('#reg').css('background',"#FFFF00");
          $('#log').css('background',"#FF9933");

         });
         $('#regisetrs').click(function(){
          $('#log').css('background',"#FFFF00");
          $('#reg').css('background',"#FF9933");
         });

         $('#log').click(function(){
          $('#reg').css('background',"#FFFF00");
          $('#log').css('background',"#FF9933");

         });
         $('#reg').click(function(){
          $('#log').css('background',"#FFFF00");
          $('#reg').css('background',"#FF9933");
         });
//======================手机号===================================
//======================手机号===================================
//密码验证
 $('#phone').blur(function(){
   var reg = /^1(3|4|5|7|8)\d{9}$/;
   if(reg.test($(this).val())){
     PhoneOk = true;
     $(this).parent('p').find('span').html('√').css('color','green');
     $(this).parent('p').attr('class','form-group has-success');
   }else{
     $(this).parent('p').find('span').html('手机号不正确').css('color','red');
     $(this).parent('p').attr('class','form-group has-error');
     PhoneOk = false;
   }
 })
//======================手机号===================================

          var i;
          $('#getcode').click(function(){
               $('#getcode').attr("disabled","true");
              $.ajax({
                url:'/login/yzm',
                data:{phone:$('#phone').attr('value')},
                type:'get',
                success:function(data){
                  
                },
                async:false
              })

              i=60;
              var init = setInterval(function(){
                  $('#getcode').html(i);
                  $('#getcode').attr("disabled","false");

                  if(i<=0){
                    $('#getcode').html("获取验证码");
                    $('#getcode').removeAttr("disabled");
                  clearInterval(init);
                  }
                  i--;
              },1000);
         });
//============================================================================================        

           $('#yzm').blur(function(){

           	//判断手机号是否为空和PhoneisOk
           	if($("#phone").val()!='' && PhoneisOk){
           		  $.ajaxSetup({
           		        headers: {
           		            'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
           		        }
           		});
           		$.ajax({
           		  url:'/login/contrast',
           		  data:{code:$('#yzm').attr('value')},
           		  type:'post',
           		  success:function(data){
           		    if(data==1){
           		      $('#yzmok').html('√').css('color','green');
           		      YzmOk = true;
           		    }else{
           		      $('#yzmok').html('验证码不正确').css('color','red');
           		       YzmOk = false;
           		    }
           		  },
           		  async:false
           		})
           	}else{
           		$('#yzmok').html('请输入手机号').css('color','red');
           	}
         });
 </script>
</html>